#include <stdio.h>
#include "camellia.h"

// takes two command line arguments
//  - input pgm file
//  - output pgm file
int main(int argc, char **argv)
{
    CamImage source,resampled;
    CamWarpingParams params;
    int t1,t2;
    int c;

    camLoadPGM(&source,argv[1]);
    camAllocateImage(&resampled,source.width/2,source.height/2,source.depth);

    for (c=0;c<100;c++)
    {
	    params.interpolation=0;

	    params.perspective=0;
	    params.p[0].x=0;
	    params.p[0].y=0;
	    params.p[1].x=(source.width<<16)-1;
	    params.p[1].y=0;
	    params.p[2].x=(source.width<<16)-1;
	    params.p[2].y=(source.height<<16)-1;
	    params.p[3].x=0;
	    params.p[3].y=(source.height<<16)-1;
	    camWarping(&source,&resampled,&params);
    }
	
    //t1=camGetTimeMs();
    //t2=camGetTimeMs();
    //printf("resampling= %d us\n",t2-t1);

    camSavePGM(&resampled,argv[2]);

}
